<?php
namespace Core\annotationhandlers;

use Core\annotations\RequestMapping;
use Core\BeanFactory;

return [
   RequestMapping::class=>function(\ReflectionMethod $method,$instance,$self){
            $path=$self->value;//uri
            $rquest_method=count($self->method)>0?$self->method:['GET'];
            $router_collector=BeanFactory::getBean("RouterCollector");

            //收集路由
           $router_collector->addRouter($rquest_method,$path,function () use($method,$instance){
               return $method->invoke($instance);//执行反射方法
           });
           return $instance;


   }
];